package com.fable.sgms.user.api.controller;

import com.fable.common.annotation.SaveSysLog;
import com.fable.sgms.user.api.vo.UserVO;
import com.fable.sgms.user.dao.entity.SysUser;
import com.fable.sgms.user.service.UserService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(value = "/api/user")
public class UserController {

    @Resource
    private UserService userService;

    @SaveSysLog("新增用户")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public UserVO save(@RequestBody UserVO userVO) {
        return userService.save(userVO);
    }

    @RequestMapping(value = "/findAll",method = RequestMethod.GET)
    public List<SysUser> findAll(){
        return userService.findAll();
    }

    @RequestMapping(value = "/query",method = RequestMethod.POST)
    public PageInfo<SysUser> query(@RequestBody UserVO vo){
        return userService.query(vo);
    }
}
